import * as actionType from '../actions/actionType';

const initState = {
  pageTitle: '首页',
  isSubpage: false
}
export default (state = initState, action)=> {
  switch(action.type) {
    case actionType.CHANGE_PAGE_TITLE:
      if(Object.prototype.toString.call(action.title) !== '[object String]') {
        return state;
      };
      return {
        ...state,
        pageTitle: action.title
      };
    case actionType.TOGGLE_IS_SUBPAGE:
      return {
        ...state,
        isSubpage: action.isSubpage
      };
    default:
      return state;
  }
}